<html>
<head>
	<title>bai3</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link href=../style/mystyle.css rel=stylesheet type="text/css"></link>
</head>
<body>
<ul>
     <li><a href="trangchu.php">Update</a></li>     
    </li>
 </ul>
<h1>Update Database</h1>
<?php
    $con=@mysqli_connect("localhost","root","","it3");
    if(!$con) die("Connection failed");
   $row = 0;
    mysqli_query($con,"set names utf8");
if (($handle = fopen("user.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
		$row++;
		if($row >=2){
        for ($c=0; $c < $num; $c++) {
			 $sql="Insert Into user 
			 values( '$data[0]', '$data[1]','$data[2]','$data[3]','$data[4]')";
			 $rs=@mysqli_query($con,$sql);
        }
		echo "Update thông tin thành công";
    }
   }
    fclose($handle);
	mysqli_close($con);
}
?>
</body>
</html>